#include "element.h"

Point_1::Point_1()
{
    coord = new double [1];
    index = -1;
};
Point_1::Point_1(double _x)
{
    coord = new double [1];
    *coord = _x;
    index = 1;
};
Point_1::Point_1(double _x, int _index)
{
    coord = new double [1];
    *coord = _x;
    index = _index;
};
Point_1::~Point_1()
{
    delete []coord;
};
 int Point_1:: get_index() const
{
    return index;
};
int Point_1:: set_index(int _i)
{
    index = _i;
    return 0;
};
std::ostream& operator<<(std::ostream &_os, const Point_1 &_p)
{
    _os<<_p.index<<" : "<<_p.coord[0];
    return _os;
};
Point_1 operator +(const Point_1 &_p1, const Point_1 &_p2)
{
    Point_1 re;
    re.coord[0] = _p1.coord[0] + _p2.coord[0];
    return re;
};
Point_1 operator -(const Point_1 &_p1, const Point_1 &_p2)
{
    Point_1 re;
    re.coord[0] = _p1.coord[0] - _p2.coord[0];
    return re;
};
const Point_1& Point_1::operator=(const Point_1 &_p)
{
    if(this != &_p)
    {
        coord[0] = _p.coord[0];
        index = _p.index;
    }
    return *this;
};